home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / IO::File.Z / IO::File
Encoding:
Text File  |  1998-10-28  |  3.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      IIIIOOOO::::::::FFFFiiiilllleeee((((3333))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       IIIIOOOO::::::::FFFFiiiilllleeee((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       IO::File - supply object methods for filehandles
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           use IO::File;
  13.  
  14.           $fh = new    IO::File;
  15.           if ($fh->open("< file")) {
  16.           print    <$fh>;
  17.           $fh->close;
  18.           }
  19.  
  20.           $fh = new    IO::File "> file";
  21.           if (defined $fh) {
  22.           print    $fh "bar\n";
  23.           $fh->close;
  24.           }
  25.  
  26.           $fh = new    IO::File "file", "r";
  27.           if (defined $fh) {
  28.           print    <$fh>;
  29.           undef    $fh;       # automatically closes the file
  30.           }
  31.  
  32.           $fh = new    IO::File "file", O_WRONLY|O_APPEND;
  33.           if (defined $fh) {
  34.           print    $fh "corge\n";
  35.  
  36.           $pos = $fh->getpos;
  37.           $fh->setpos($pos);
  38.  
  39.           undef    $fh;       # automatically closes the file
  40.           }
  41.  
  42.           autoflush    STDOUT 1;
  43.  
  44.  
  45.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  46.       IO::File inherits from IO::Handle and    IO::Seekable. It
  47.       extends these    classes    with methods that are specific to file
  48.       handles.
  49.  
  50.      CCCCOOOONNNNSSSSTTTTRRRRUUUUCCCCTTTTOOOORRRR
  51.       new ([ ARGS ]    )
  52.           Creates a    IO::File.  If it receives any parameters, they
  53.           are passed to the    method open; if    the open fails,    the
  54.           object is    destroyed.  Otherwise, it is returned to the
  55.           caller.
  56.  
  57.       new_tmpfile
  58.           Creates an IO::File opened for read/write    on a newly
  59.           created temporary    file.  On systems where    this is
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      IIIIOOOO::::::::FFFFiiiilllleeee((((3333))))     22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))       IIIIOOOO::::::::FFFFiiiilllleeee((((3333))))
  71.  
  72.  
  73.  
  74.           possible,    the temporary file is anonymous    (i.e. it is
  75.           unlinked after creation, but held    open).    If the
  76.           temporary    file cannot be created or opened, the IO::File
  77.           object is    destroyed.  Otherwise, it is returned to the
  78.           caller.
  79.  
  80.      MMMMEEEETTTTHHHHOOOODDDDSSSS
  81.       open(    FILENAME [,MODE    [,PERMS]] )
  82.           open accepts one,    two or three parameters.  With one
  83.           parameter, it is just a front end    for the    built-in open
  84.           function.     With two parameters, the first    parameter is a
  85.           filename that may    include    whitespace or other special
  86.           characters, and the second parameter is the open mode,
  87.           optionally followed by a file permission value.
  88.  
  89.           If IO::File::open    receives a Perl    mode string (">",
  90.           "+<", etc.)  or a    POSIX _f_o_p_e_n() mode string ("w",    "r+",
  91.           etc.), it    uses the basic Perl open operator.
  92.  
  93.           If IO::File::open    is given a numeric mode, it passes
  94.           that mode    and the    optional permissions value to the Perl
  95.           sysopen operator.     For convenience, IO::File::import
  96.           tries to import the O_XXX    constants from the Fcntl
  97.           module.  If dynamic loading is not available, this may
  98.           fail, but    the rest of IO::File will still    work.
  99.  
  100.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  101.       the _p_e_r_l_f_u_n_c manpage,    the section on _I/_O _O_p_e_r_a_t_o_r_s in    the
  102.       _p_e_r_l_o_p manpage, the _I_O::_H_a_n_d_l_e manpage the _I_O::_S_e_e_k_a_b_l_e
  103.       manpage
  104.  
  105.      HHHHIIIISSSSTTTTOOOORRRRYYYY
  106.       Derived from FileHandle.pm by    Graham Barr
  107.       <_b_o_d_g@_t_i_u_k._t_i._c_o_m>.
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.